<?php 
  require(dirname(__FILE__)."/global.php");
  require(ROOT."/admin/isLogin.php");
  
  $submit = $_POST['submit'];
  if(isset($submit)){
      $dels = $_POST['del'];
      foreach($dels as $del)
      {
          $temp = explode('@',$del);
          if($temp[0] == 'del')
          {
              $sql = "delete from talking_user where UserID = '$temp[1]'";
              $db->execute($sql);
          }
          else if($temp[0] == 'pass')
          {  
              $sql = "update talking_user set UserGroup='4' where UserID = '$temp[1]'";
              $db->execute($sql);
          }
      }
      $smarty->assign('tip','提交成功');
  }
  $sql = "SELECT UserID,UserName,UserRealName,UserEmail,UserPostNum,UserRegistTime,UserLastLoginTime FROM talking_user WHERE UserGroup = 3";
  $users = $db->query($sql);
  $smarty->assign('users',$users);
  $smarty->display("user_approve.html");
  $db->close();                                    
?>
